package com.sinosoft.jike;

public class FizzBuzz {

    public static String printRule(Integer number){
        StringBuilder result = new StringBuilder();
        if (rule(number, 3)) result.append("Fizz");
        if (rule(number, 5)) result.append("Buzz");

        if (result.toString().equals("")){
            result.append(number.toString());
        }
        return result.toString();
    }

    /**
     * 判断规则，如果是multiple 的倍数或字符包含containsNum 判断为true
     * @param number
     * @param multiple
     * @return
     */
    public static boolean rule(Integer number, Integer multiple){
        return number%multiple == 0 || number.toString().contains(multiple.toString());
    }

}
